package com.xcc.consumer.hystrix.controller;


import com.xcc.consumer.hystrix.service.fallback.PaymentHystrixFallbackService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
public class OrderHystrixControllerFallbackClass {

    @Resource
    private PaymentHystrixFallbackService paymentHystrixFallbackService;

    @Value("${server.port}")
    private String serverPort;

    @GetMapping("/consumer_all/payment/hystrix/ok/{id}")
    public String paymentInfo_OK(@PathVariable("id") Integer id) {
        String result = paymentHystrixFallbackService.paymentInfo_OK(id);
        log.info("*******result:" + result);
        return result;
    }

    @GetMapping("/consumer_all/payment/hystrix/timeout/{id}")
    public String paymentInfo_TimeOut(@PathVariable("id") Integer id) {
        String result = paymentHystrixFallbackService.paymentInfo_TimeOut(id);
        return result;
    }

}
